using Api.Model;
using Api.Repository;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddControllers();

var conString = builder.Configuration.GetConnectionString("mysql");
builder.Services.AddDbContext<AdminDbContext>(x => x.UseMySql(conString,ServerVersion.AutoDetect(conString)));
builder.Services.AddScoped(typeof(IRepository<>), typeof(EfRepository<>));

var app = builder.Build();


app.UseHttpsRedirection();

app.MapControllers();

app.Run();


